package com.bookquery.service;

import com.bookquery.dao.BaseDao;
import com.bookquery.dao.BookQueryDao;
import com.bookquery.dao.BookQueryDaoImpl;
import com.bookquery.entity.BookQuery;
import com.bookquery.util.DatabaseUtil;

import javax.naming.NamingException;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public class BookQueryServiceImpl implements BookQueryService{


    @Override
    public List<BookQuery> getAll() {

        Connection connection=null;
        try {
            connection= DatabaseUtil.getConnection();
            return  new BookQueryDaoImpl(connection).getAll();
        } catch (SQLException | NamingException e) {
            e.printStackTrace();
        }finally {
            DatabaseUtil.closeAll(connection,null,null);
        }
        return null;

    }
}
